using System;
using System.Data.SqlClient;

namespace koPtoMetro.Data
{
	public class Conexion
	{
		public void Conectar(SqlConnection con )
		{
			con = new SqlConnection(System.Configuration.ConfigurationSettings.AppSettings("SqlServer"));
		}
	
		public void ConectarSqlHelper(String NombreStored, SqlParameter [] arregloParametros)
		{
			try
			{
				SqlConnection con;
				con = new SqlConnection(System.Configuration.ConfigurationSettings.AppSettings("SqlServer"));
				SqlHelper.ExecuteNonQuery(con, CommandType.StoredProcedure, NombreStored, arregloParametros);
				con.Close();
			}
			catch (System.Data.SqlClient.SqlException ex)		
			{
				MsgBox(ex.Message);
			}
		}
			
		public void ConectarSqlHelper(String NombreStored )
		{
			try
			{
				SqlConnection con;
				con = new SqlConnection(System.Configuration.ConfigurationSettings.AppSettings("SqlServer"));
				SqlHelper.ExecuteNonQuery(con, CommandType.StoredProcedure, NombreStored);
				con.Close();
			}
			catch (System.Data.SqlClient.SqlException ex) 
			{
				MsgBox(ex.Message);
			}
	
	
		}
	
		public void ExecuteDataSet(DataSet dataSet,String NombreStored, SqlParameter [] arregloParametros)
		{
			try
			{
				SqlConnection con;
				con = new SqlConnection(System.Configuration.ConfigurationSettings.AppSettings("SqlServer"));
				dataSet = SqlHelper.ExecuteDataset(con, CommandType.StoredProcedure, NombreStored, arregloParametros);
				con.Close();
			}
			catch (System.Data.SqlClient.SqlException ex )
			{
				MsgBox(ex.Message);
			}
		}
	}
}





